package com.itheima.vo;

import com.itheima.domain.Order;
import com.itheima.domain.OrderItem;
import com.itheima.domain.OrderOperateHistory;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;


import java.io.Serializable;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailsVo extends Order implements Serializable {
    private List<OrderOperateHistory> historyList;
    private List<OrderItem> orderItemList;

    public static OrderDetailsVo init(Order order, List<OrderOperateHistory> list, List<OrderItem> orderItemList) {
        OrderDetailsVo vo = new OrderDetailsVo();
        BeanUtils.copyProperties(order, vo);
        vo.setHistoryList(list);
        vo.setOrderItemList(orderItemList);
        return vo;
    }
}